home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus Special 23
/
AMIGAplus Sonderheft 23 (2000)(Falke)(DE)[!].iso
/
PublicDomain
/
Goldies
/
PolyEd2
/
Macros
/
center.ped
< prev
next >
Wrap
Text File
|
1999-11-08
|
2KB
|
60 lines
/*
** $VER: empty.rexx 2.0 (5.3.95) written by Robert Brandner
**
** This centers the current line according to the current
** right-border width.
**
*/
OPTIONS RESULTS
OPTIONS FAILAT 11 /* ignore warnings */
SIGNAL ON SYNTAX /* ensure clean exit */
SIGNAL ON FAILURE
SIGNAL ON BREAK_C /* no label->syntax->exit */
if (LEFT(ADDRESS(), 6) ~= "POLYED") then do
if SHOW("Ports", "POLYED.1") then
address 'POLYED.1'
else do
say "PolyEd is not running!"
exit
end
end
'LOCKGUI'
/*----- begin of custom code area --------------------------------------*/
'GETCURSORPOS STEM CPOS.' /* get cursorposition */
'GETLINE VAR LINE' /* get current line */
'GETATTR APPLICATION FIELD VAR_RIGHTBORDER VAR WIDTH' /* width */
/* strip leading and trailing spaces and center the remaining text
** according to the demanded width (which is quite easy thanks to Rexx)
*/
LINE = strip(LINE, 'B')
if length(LINE) <= WIDTH then do
LINE = center(LINE, WIDTH)
LINE = strip(LINE, 'T') /* remove spaces added by center */
'POSITION SOL' /* go to start of line */
'DELETE EOL' /* clear line */
'TEXT' TEXT LINE /* insert centered line */
'GOTOCOLUMN' CPOS.COLUMN /* reset cursor-position */
end
/*----- end of custom code area ----------------------------------------*/
'UNLOCKGUI' /* clean exit */
EXIT
SYNTAX: /* ARexx error... */
say "Error line" SIGL ":" ERRORTEXT(RC) /* report it... */
'UNLOCKGUI' /* Unlock GUI! */
EXIT /* exit */
FAILURE:
'UNLOCKGUI' /* Unlock GUI! */
EXIT /* exit */